package nl.hanze.designpatterns.Controllers;

import nl.hanze.designpatterns.Domain.LoginCredential;
import nl.hanze.designpatterns.Models.MainModel;
import nl.hanze.designpatterns.Views.MainScreen;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 *
 * Created by Aron on 23-9-2014.
 */
public class LoginController {

    private MainModel mainModel;
    private MainScreen mainScreen;

    public LoginController(MainScreen mainScreen, MainModel mainModel) {
        this.mainScreen = mainScreen;
        this.mainModel = mainModel;
    }

    public void login(String username, String password) {
        System.out.println("[LOGIN]: "+username+"::"+password);
        if (mainModel.login(new LoginCredential(username, password))) {
            mainScreen.changeView("ticket");
        }
    }

    public void changeDAOFactory(String item) {
        mainModel.changeDAOFactory(item);
    }
}
